<template>
  <div class="search">
    <input type="text" placeholder="请输入关键字" v-model="searchVal" @keyup.enter="queryResult">
    <div class="search-btn" @click="queryResult">
      <img src="@/assets/images/news/search.png" alt="">
      <div>搜索</div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      searchVal: ''
    }
  },
  methods: {
    queryResult() {
      this.$emit('searchQuery', this.searchVal)
    }
  }
}
</script>
<style lang="scss" scoped>
.search {
  width: 360px;
  line-height:44px;
  border-radius:23px;
  border:1px solid rgba(221,221,221,1);
  display: flex;
  justify-content: space-between;
}
.search input {
  border: none;
  outline: none;
  background: none;
  flex-grow: 1;
  height: 44px;
  border-radius: 23px;
  padding: 0 20px;
}
.search-btn {
  width: 112px;
  height: 46px;
  background: #2D87FA;
  border-radius: 23px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 17px;
  color: white;
  margin-top: -1px;
  margin-right: -1px;
  cursor: pointer;
}
.search-btn img {
  width: 20px;
  height: 20px;
  margin-right: 11px;
}
</style>